import Vue from "vue";
import Vuex from "vuex";
import app from "./modules/app";
import dict from "./modules/dict";
import user from "./modules/user";
import tagsView from "./modules/tagsView";
import studyVuex from "./modules/studyVuex";
import permission from "./modules/permission";
import settings from "./modules/settings";
// import createPersistedState from "vuex-persistedstate";
import getters from "./getters";

Vue.use(Vuex);

const store = new Vuex.Store({
  // plugins: [createPersistedState()],
  modules: {
    app,
    dict,
    user,
    tagsView,
    permission,
    settings,
    studyVuex,
  },
  getters,
});

// // 使用插件
// store.plugin(
//   createPersistedState({
//     key: "my-app",
//     storage: window.localStorage,
//     paths: ["studyVuex"], // 仅持久化这些路径
//   })
// );

export default store;
